#include "stdio.h"
#include "./ALGraph.h"

void CreateGraph(ALGraph GL, int n, int e) // n为顶点数，e为图的边数
{
    int i, j, k;
    EdgeNode *p;
    for (i = 0; i < n; i++) // 建立顶点表
    {
        GL[i].vertex = getchar(); // 读入顶点信息
        GL[i].link = NULL;        // 边表头指针置空
    }
    for (k = 0; k < e; k++)
    {
        scanf("%d, %d", &i, &j);
        p = (EdgeNode *)malloc(sizeof(EdgeNode));

        p->adjvex = j;
        p->next = GL[i].link;
        p = (EdgeNode *)malloc(sizeof(EdgeNode));

        p->adjvex = i;
        p->next = GL[j].link;
        GL[j].link = p;
    }
}